package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.entity.User;

import java.util.List;

public interface UserMapper  extends BaseMapper<User> {
    @Select("SELECT * FROM user WHERE id = #{id}")
    User findById(int id);
    @Select("SELECT * FROM user WHERE role=#{role}")
    List<User> selectRole(String role);
    @Select("SELECT * FROM user WHERE classname=#{className} and name!=#{name}")
    List<User> selectbyclassname(@Param("className") String className,@Param("name") String name);
    @Select("SELECT * FROM user WHERE name=#{username}")
    List<User> AvatarUrl(@Param("username")String username);
    @Select("SELECT name FROM user WHERE id=#{valueOf}")
    String selectbyId(@Param("valueOf") Integer valueOf);

    @Select("SELECT * FROM user WHERE name = #{name}")
    User selectByUsername2(String name);
}
